<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link href="http://search.cpan.org/s/style.css" rel="stylesheet" type="text/css">
<title>GeoidEval(1)</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body>



<h1 id="NAME">NAME</h1>

<p>GeoidEval -- look up geoid heights</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<p><b>GeoidEval</b> [ <b>-n</b> <i>name</i> ] [ <b>-d</b> <i>dir</i> ] [ <b>-l</b> ] [ <b>-a</b> | <b>-c</b> <i>south</i> <i>west</i> <i>north</i> <i>east</i> ] [ <b>-w</b> ] [ <b>-z</b> <i>zone</i> ] [ <b>--msltohae</b> ] [ <b>--haetomsl</b> ] [ <b>-v</b> ] [ <b>--comment-delimiter</b> <i>commentdelim</i> ] [ <b>--version</b> | <b>-h</b> | <b>--help</b> ] [ <b>--input-file</b> <i>infile</i> | <b>--input-string</b> <i>instring</i> ] [ <b>--line-separator</b> <i>linesep</i> ] [ <b>--output-file</b> <i>outfile</i> ]</p>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p><b>GeoidEval</b> reads in positions on standard input and prints out the corresponding heights of the geoid above the WGS84 ellipsoid on standard output.</p>

<p>Positions are given as latitude and longitude, UTM/UPS, or MGRS, in any of the formats accepted by GeoConvert(1). (MGRS coordinates signify the <i>center</i> of the corresponding MGRS square.) If the <b>-z</b> option is specified then the specified zone is prepended to each line of input (which must be in UTM/UPS coordinates). This allows a file with UTM eastings and northings in a single zone to be used as standard input.</p>

<p>More accurate results for the geoid height are provided by Gravity(1). This utility can also compute the direction of gravity accurately.</p>

<p>The height of the geoid above the ellipsoid, <i>N</i>, is sometimes called the geoid undulation. It can be used to convert a height above the ellipsoid, <i>h</i>, to the corresponding height above the geoid (the orthometric height, roughly the height above mean sea level), <i>H</i>, using the relations</p>

<ul>

<p><i>h</i> = <i>N</i> + <i>H</i>, &nbsp;&nbsp;<i>H</i> = -<i>N</i> + <i>h</i>.</p>

</ul>

<h1 id="OPTIONS">OPTIONS</h1>

<dl>

<dt id="n-name"><b>-n</b> <i>name</i></dt>
<dd>

<p>use geoid <i>name</i> instead of the default <code>egm96-5</code>. See <a href="#GEOIDS">&quot;GEOIDS&quot;</a>.</p>

</dd>
<dt id="d-dir"><b>-d</b> <i>dir</i></dt>
<dd>

<p>read geoid data from <i>dir</i> instead of the default. See <a href="#GEOIDS">&quot;GEOIDS&quot;</a>.</p>

</dd>
<dt id="l"><b>-l</b></dt>
<dd>

<p>use bilinear interpolation instead of cubic. See <a href="#INTERPOLATION">&quot;INTERPOLATION&quot;</a>.</p>

</dd>
<dt id="a"><b>-a</b></dt>
<dd>

<p>cache the entire data set in memory. See <a href="#CACHE">&quot;CACHE&quot;</a>.</p>

</dd>
<dt id="c-south-west-north-east"><b>-c</b> <i>south</i> <i>west</i> <i>north</i> <i>east</i></dt>
<dd>

<p>cache the data bounded by <i>south</i> <i>west</i> <i>north</i> <i>east</i> in memory. The first two arguments specify the SW corner of the cache and the last two arguments specify the NE corner. The <b>-w</b> flag specifies that longitude precedes latitude for these corners, provided that it appears before <b>-c</b>. See <a href="#CACHE">&quot;CACHE&quot;</a>.</p>

</dd>
<dt id="w"><b>-w</b></dt>
<dd>

<p>toggle the longitude first flag (it starts off); if the flag is on, then when reading geographic coordinates, longitude precedes latitude (this can be overridden by a hemisphere designator, <i>N</i>, <i>S</i>, <i>E</i>, <i>W</i>).</p>

</dd>
<dt id="z-zone"><b>-z</b> <i>zone</i></dt>
<dd>

<p>prefix each line of input by <i>zone</i>, e.g., <code>38n</code>. This should be used when the input consists of UTM/UPS eastings and northings.</p>

</dd>
<dt id="msltohae"><b>--msltohae</b></dt>
<dd>

<p>standard input should include a final token on each line which is treated as a height (in meters) above the geoid and the output echoes the input line with the height converted to height above ellipsoid (HAE). If <b>-z</b> <i>zone</i> is specified then the <i>third</i> token is treated as the height; this makes it possible to convert LIDAR data where each line consists of: easting northing height intensity.</p>

</dd>
<dt id="haetomsl"><b>--haetomsl</b></dt>
<dd>

<p>this is similar to <b>--msltohae</b> except that the height token is treated as a height (in meters) above the ellipsoid and the output echoes the input line with the height converted to height above the geoid (MSL).</p>

</dd>
<dt id="v"><b>-v</b></dt>
<dd>

<p>print information about the geoid on standard error before processing the input.</p>

</dd>
<dt id="comment-delimiter-commentdelim"><b>--comment-delimiter</b> <i>commentdelim</i></dt>
<dd>

<p>set the comment delimiter to <i>commentdelim</i> (e.g., &quot;#&quot; or &quot;//&quot;). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).</p>

</dd>
<dt id="version"><b>--version</b></dt>
<dd>

<p>print version and exit.</p>

</dd>
<dt id="h"><b>-h</b></dt>
<dd>

<p>print usage, the default geoid path and name, and exit.</p>

</dd>
<dt id="help"><b>--help</b></dt>
<dd>

<p>print full documentation and exit.</p>

</dd>
<dt id="input-file-infile"><b>--input-file</b> <i>infile</i></dt>
<dd>

<p>read input from the file <i>infile</i> instead of from standard input; a file name of &quot;-&quot; stands for standard input.</p>

</dd>
<dt id="input-string-instring"><b>--input-string</b> <i>instring</i></dt>
<dd>

<p>read input from the string <i>instring</i> instead of from standard input. All occurrences of the line separator character (default is a semicolon) in <i>instring</i> are converted to newlines before the reading begins.</p>

</dd>
<dt id="line-separator-linesep"><b>--line-separator</b> <i>linesep</i></dt>
<dd>

<p>set the line separator character to <i>linesep</i>. By default this is a semicolon.</p>

</dd>
<dt id="output-file-outfile"><b>--output-file</b> <i>outfile</i></dt>
<dd>

<p>write output to the file <i>outfile</i> instead of to standard output; a file name of &quot;-&quot; stands for standard output.</p>

</dd>
</dl>

<h1 id="GEOIDS">GEOIDS</h1>

<p><b>GeoidEval</b> computes geoid heights by interpolating on the data in a regularly spaced table (see <a href="#INTERPOLATION">&quot;INTERPOLATION&quot;</a>). The following geoid tables are available (however, some may not be installed):</p>

<pre><code>                                  bilinear error    cubic error
   name         geoid    grid     max      rms      max      rms
   egm84-30     EGM84    30&#39;      1.546 m  70 mm    0.274 m  14 mm
   egm84-15     EGM84    15&#39;      0.413 m  18 mm    0.021 m  1.2 mm
   egm96-15     EGM96    15&#39;      1.152 m  40 mm    0.169 m  7.0 mm
   egm96-5      EGM96     5&#39;      0.140 m  4.6 mm   .0032 m  0.7 mm
   egm2008-5    EGM2008   5&#39;      0.478 m  12 mm    0.294 m  4.5 mm
   egm2008-2_5  EGM2008   2.5&#39;    0.135 m  3.2 mm   0.031 m  0.8 mm
   egm2008-1    EGM2008   1&#39;      0.025 m  0.8 mm   .0022 m  0.7 mm</code></pre>

<p>By default, the <code>egm96-5</code> geoid is used. This may changed by setting the environment variable <code>GEOGRAPHICLIB_GEOID_NAME</code> or with the <b>-n</b> option. The errors listed here are estimates of the quantization and interpolation errors in the reported heights compared to the specified geoid.</p>

<p>The geoid data will be loaded from a directory specified at compile time. This may changed by setting the environment variables <code>GEOGRAPHICLIB_GEOID_PATH</code> or <code>GEOGRAPHICLIB_DATA</code>, or with the <b>-d</b> option. The <b>-h</b> option prints the default geoid path and name. Use the <b>-v</b> option to ascertain the full path name of the data file.</p>

<p>Instructions for downloading and installing geoid data are available at <a href="https://geographiclib.sourceforge.io/html/geoid.html#geoidinst">https://geographiclib.sourceforge.io/html/geoid.html#geoidinst</a>.</p>

<p><b>NOTE</b>: all the geoids above apply to the WGS84 ellipsoid (<i>a</i> = 6378137 m, <i>f</i> = 1/298.257223563) only.</p>

<h1 id="INTERPOLATION">INTERPOLATION</h1>

<p>Cubic interpolation is used to compute the geoid height unless <b>-l</b> is specified in which case bilinear interpolation is used. The cubic interpolation is based on a least-squares fit of a cubic polynomial to a 12-point stencil</p>

<pre><code>   . 1 1 .
   1 2 2 1
   1 2 2 1
   . 1 1 .</code></pre>

<p>The cubic is constrained to be independent of longitude when evaluating the height at one of the poles. Cubic interpolation is considerably more accurate than bilinear; however it results in small discontinuities in the returned height on cell boundaries.</p>

<h1 id="CACHE">CACHE</h1>

<p>By default, the data file is randomly read to compute the geoid heights at the input positions. Usually this is sufficient for interactive use. If many heights are to be computed, use <b>-c</b> <i>south</i> <i>west</i> <i>north</i> <i>east</i> to notify <b>GeoidEval</b> to read a rectangle of data into memory; heights within the this rectangle can then be computed without any disk access. If <b>-a</b> is specified all the geoid data is read; in the case of <code>egm2008-1</code>, this requires about 0.5 GB of RAM. The evaluation of heights outside the cached area causes the necessary data to be read from disk. Use the <b>-v</b> option to verify the size of the cache.</p>

<p>Regardless of whether any cache is requested (with the <b>-a</b> or <b>-c</b> options), the data for the last grid cell in cached. This allows the geoid height along a continuous path to be returned with little disk overhead.</p>

<h1 id="ENVIRONMENT">ENVIRONMENT</h1>

<dl>

<dt id="GEOGRAPHICLIB_GEOID_NAME"><b>GEOGRAPHICLIB_GEOID_NAME</b></dt>
<dd>

<p>Override the compile-time default geoid name of <code>egm96-5</code>. The <b>-h</b> option reports the value of <b>GEOGRAPHICLIB_GEOID_NAME</b>, if defined, otherwise it reports the compile-time value. If the <b>-n</b> <i>name</i> option is used, then <i>name</i> takes precedence.</p>

</dd>
<dt id="GEOGRAPHICLIB_GEOID_PATH"><b>GEOGRAPHICLIB_GEOID_PATH</b></dt>
<dd>

<p>Override the compile-time default geoid path. This is typically <code>/usr/local/share/GeographicLib/geoids</code> on Unix-like systems and <code>C:/ProgramData/GeographicLib/geoids</code> on Windows systems. The <b>-h</b> option reports the value of <b>GEOGRAPHICLIB_GEOID_PATH</b>, if defined, otherwise it reports the compile-time value. If the <b>-d</b> <i>dir</i> option is used, then <i>dir</i> takes precedence.</p>

</dd>
<dt id="GEOGRAPHICLIB_DATA"><b>GEOGRAPHICLIB_DATA</b></dt>
<dd>

<p>Another way of overriding the compile-time default geoid path. If it is set (and if <b>GEOGRAPHICLIB_GEOID_PATH</b> is not set), then $<b>GEOGRAPHICLIB_DATA</b>/geoids is used.</p>

</dd>
</dl>

<h1 id="ERRORS">ERRORS</h1>

<p>An illegal line of input will print an error message to standard output beginning with <code>ERROR:</code> and causes <b>GeoidEval</b> to return an exit code of 1. However, an error does not cause <b>GeoidEval</b> to terminate; following lines will be converted.</p>

<h1 id="ABBREVIATIONS">ABBREVIATIONS</h1>

<p>The geoid is usually approximated by an &quot;earth gravity model&quot;. The models published by the NGA are:</p>

<dl>

<dt id="EGM84"><b>EGM84</b></dt>
<dd>

<p>An earth gravity model published by the NGA in 1984, <a href="http://earth-info.nga.mil/GandG/wgs84/gravitymod/wgs84_180/wgs84_180.html">http://earth-info.nga.mil/GandG/wgs84/gravitymod/wgs84_180/wgs84_180.html</a>.</p>

</dd>
<dt id="EGM96"><b>EGM96</b></dt>
<dd>

<p>An earth gravity model published by the NGA in 1996, <a href="http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html">http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html</a>.</p>

</dd>
<dt id="EGM2008"><b>EGM2008</b></dt>
<dd>

<p>An earth gravity model published by the NGA in 2008, <a href="http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008">http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008</a>.</p>

</dd>
<dt id="WGS84"><b>WGS84</b></dt>
<dd>

<p>World Geodetic System 1984, <a href="https://en.wikipedia.org/wiki/WGS84">https://en.wikipedia.org/wiki/WGS84</a>.</p>

</dd>
<dt id="HAE"><b>HAE</b></dt>
<dd>

<p>Height above the WGS84 ellipsoid.</p>

</dd>
<dt id="MSL"><b>MSL</b></dt>
<dd>

<p>Mean sea level, used as a convenient short hand for the geoid. (However, typically, the geoid differs by a few meters from mean sea level.)</p>

</dd>
</dl>

<h1 id="EXAMPLES">EXAMPLES</h1>

<p>The height of the EGM96 geoid at Timbuktu</p>

<pre><code>    echo 16:46:33N 3:00:34W | GeoidEval
    =&gt; 28.7068 -0.02e-6 -1.73e-6</code></pre>

<p>The first number returned is the height of the geoid and the 2nd and 3rd are its slopes in the northerly and easterly directions.</p>

<p>Convert a point in UTM zone 18n from MSL to HAE</p>

<pre><code>   echo 531595 4468135 23 | GeoidEval --msltohae -z 18n
   =&gt; 531595 4468135 -10.842</code></pre>

<h1 id="SEE-ALSO">SEE ALSO</h1>

<p>GeoConvert(1), Gravity(1), geographiclib-get-geoids(8).</p>

<p>An online version of this utility is availbable at <a href="https://geographiclib.sourceforge.io/cgi-bin/GeoidEval">https://geographiclib.sourceforge.io/cgi-bin/GeoidEval</a>.</p>

<h1 id="AUTHOR">AUTHOR</h1>

<p><b>GeoidEval</b> was written by Charles Karney.</p>

<h1 id="HISTORY">HISTORY</h1>

<p><b>GeoidEval</b> was added to GeographicLib, <a href="https://geographiclib.sourceforge.io">https://geographiclib.sourceforge.io</a>, in 2009-09.</p>


</body>

</html>


